<template>
  <view class='articleDetail'>
    <view
      class="content"
      v-html="content"
    ></view>
    <view></view>
  </view>
</template>
<script>
import './more.less'
import Taro from '@tarojs/taro'
export default {
  data() {
    return {
      title:'',
      content : '',
    }
  },
  created() {
    // 建议在页面初始化时把 getCurrentInstance() 的结果保存下来供后面使用，
    // 而不是频繁地调用此 API
    this.$instance = Taro.getCurrentInstance()
    // console.log(this.$instance.router.params);
  },

   mounted() {
    // 获取路由参数
    this.title = this.$instance.router.params.title || '';
    this.content =decodeURIComponent(this.$instance.router.params.content || '')
    this.getarticle();
  },

   methods: {
    getarticle() {
      let that = this
      //打印获取的数据源
      let _data = that.content;
      const assetsPath = that.$mConfig.assetsPath;
      let reg = new RegExp('src="/blobs/filds', 'g')//g代表全部 把字符串中所有=换成&&&
      _data = _data.replace(reg, ' mode="widthFix" src="' + assetsPath + '/blobs/filds');
      _data = _data.replace(/&nbsp;/g, '\xa0')

      // console.log(_data);
      that.content = _data
      Taro.setNavigationBarTitle({
        title: that.title
      })
   

    }
  }


}
</script>
<style>
</style>